<html>
<head><meta charset="utf-8"><title>pr-52782-dangly-paths-for-box · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html">pr-52782-dangly-paths-for-box</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="130707249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707249">(Aug 01 2018 at 11:25)</a>:</h4>
<p>@eddyb so here's a super simple example of something that breaks if you leave out the <code>(shallow) Write(StorageDeadOrDrop) of the deref-box</code>:</p>



<a name="130707250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707250">(Aug 01 2018 at 11:25)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">return_local_box_borrow</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">i32</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Box</span>::<span class="n">new</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;*</span><span class="n">b</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="130707296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707296">(Aug 01 2018 at 11:26)</a>:</h4>
<p>if you leave out that step, the above code gets accepted by NLL.</p>



<a name="130707300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707300">(Aug 01 2018 at 11:26)</a>:</h4>
<p>(deleted)</p>



<a name="130707455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707455">(Aug 01 2018 at 11:30)</a>:</h4>
<p>okay but why? isn't the lifetime of the borrow tied to <code>b</code> <em>somehow</em>?</p>



<a name="130707465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707465">(Aug 01 2018 at 11:30)</a>:</h4>
<p>I'd expect it to <em>at least</em> not be able to escape the function</p>



<a name="130707467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707467">(Aug 01 2018 at 11:30)</a>:</h4>
<p><code>'a</code> shouldn't outlive <code>b</code></p>



<a name="130707479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707479">(Aug 01 2018 at 11:31)</a>:</h4>
<p>(I think this was <span class="user-mention" data-user-id="120791">@RalfJ</span>'s point - lol I can force subscribe them)</p>



<a name="130707501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707501">(Aug 01 2018 at 11:32)</a>:</h4>
<p>what happens if you <em>move</em> <code>b</code> to another local variable? does the borrow survive?</p>



<a name="130707541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707541">(Aug 01 2018 at 11:32)</a>:</h4>
<p>since a move of a <code>b</code> shouldn't touch <code>*b</code> either</p>



<a name="130707570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707570">(Aug 01 2018 at 11:33)</a>:</h4>
<p>or, say, call <code>mem::drop(b)</code>, <del>which would have no local <code>Drop(b)</code> to speak of</del> - nvm it would, it's drop elaboration that removes it later</p>



<a name="130707588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707588">(Aug 01 2018 at 11:33)</a>:</h4>
<p>it really feels like <code>StorageDead(b)</code> should kill the <code>&amp;*b</code> but maybe I'm missing something</p>



<a name="130707646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707646">(Aug 01 2018 at 11:34)</a>:</h4>
<p>maybe "variables have no scope anymore" and the only thing that can end a borrow is explicit invalidation of the thing being borrowed, and <code>*b</code> is distinct enough from <code>b</code></p>



<a name="130707649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707649">(Aug 01 2018 at 11:34)</a>:</h4>
<p>NLL is a brave new world I suppose</p>



<a name="130707681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130707681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130707681">(Aug 01 2018 at 11:35)</a>:</h4>
<p>is... regionck... just dead/swallowed whole by NLL?</p>



<a name="130708604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130708604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130708604">(Aug 01 2018 at 11:55)</a>:</h4>
<p>(sorry i was distracted for a bit)</p>



<a name="130708667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130708667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130708667">(Aug 01 2018 at 11:56)</a>:</h4>
<p>so lets see if I can address these in turn</p>



<a name="130708671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130708671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130708671">(Aug 01 2018 at 11:56)</a>:</h4>
<p>I don't see why <code>'a</code> itself shouldn't outlive <code>b</code>.</p>



<a name="130708690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130708690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130708690">(Aug 01 2018 at 11:57)</a>:</h4>
<p>after all, if the user passed in <code>input: &amp;'a i32</code>, then I should certainly be able to return <code>&amp;*input</code>, right?</p>



<a name="130708756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130708756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130708756">(Aug 01 2018 at 11:58)</a>:</h4>
<p>if you do a move of <code>b</code>, then that <em>does</em> error. It says "cannot move out of <code>b</code> because it is borrowed."</p>



<a name="130708807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130708807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130708807">(Aug 01 2018 at 11:59)</a>:</h4>
<p>but that makes sense, since a move of <code>b</code> will cause a <code>(Deep, Write(WriteKind::Move)</code> on <code>b</code></p>



<a name="130708968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130708968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130708968">(Aug 01 2018 at 12:02)</a>:</h4>
<p>and likewise, before PR <a href="https://github.com/rust-lang/rust/issues/52782" target="_blank" title="https://github.com/rust-lang/rust/issues/52782">#52782</a>, the drop of <code>b</code> would do a similar Deep Write (because <code>Box&lt;T&gt;</code> implements <code>Drop</code>)</p>



<a name="130709039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709039">(Aug 01 2018 at 12:03)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> wrote:</p>
<blockquote>
<p>it really feels like <code>StorageDead(b)</code> should kill the <code>&amp;*b</code> but maybe I'm missing something</p>
</blockquote>
<p>Right now a <code>StorageDead</code> statement causes a Shallow Write. But maybe the right answer here is for these other steps to be attached <em>there</em>?</p>



<a name="130709132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709132">(Aug 01 2018 at 12:06)</a>:</h4>
<p>aaah, so the deep version handles the general case, and your PR has to manually emulate the necessary steps!</p>



<a name="130709175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709175">(Aug 01 2018 at 12:06)</a>:</h4>
<p>I guess that is a question: where should <code>&amp;*b</code> get invalidated, by the <code>drop(b)</code> or by the <code>StorageDead(b)</code></p>



<a name="130709178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709178">(Aug 01 2018 at 12:06)</a>:</h4>
<blockquote>
<p>aaah, so the deep version handles the general case, and your PR has to manually emulate the necessary steps!</p>
</blockquote>
<p>Yes!</p>



<a name="130709185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709185">(Aug 01 2018 at 12:06)</a>:</h4>
<p>okay I didn't realize a move was deep by default</p>



<a name="130709191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709191">(Aug 01 2018 at 12:06)</a>:</h4>
<p>Yeah, I think it has to be, right?</p>



<a name="130709195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709195">(Aug 01 2018 at 12:07)</a>:</h4>
<p>/me thinks</p>



<a name="130709199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709199">(Aug 01 2018 at 12:07)</a>:</h4>
<p>have you seen <a href="https://github.com/rust-lang/rust/pull/52782#discussion_r206831556" target="_blank" title="https://github.com/rust-lang/rust/pull/52782#discussion_r206831556">https://github.com/rust-lang/rust/pull/52782#discussion_r206831556</a>?</p>



<a name="130709209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709209">(Aug 01 2018 at 12:07)</a>:</h4>
<blockquote>
<p>have you seen <a href="https://github.com/rust-lang/rust/pull/52782#discussion_r206831556" target="_blank" title="https://github.com/rust-lang/rust/pull/52782#discussion_r206831556">https://github.com/rust-lang/rust/pull/52782#discussion_r206831556</a>?</p>
</blockquote>
<p>no I had not seen that yet. Let me read it.</p>



<a name="130709258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709258">(Aug 01 2018 at 12:08)</a>:</h4>
<p>specifically the  part where <code>Drop(place)</code> should <em>always</em> invalidate the value at <code>place</code> <em>despite</em> being a noop for some types (<code>place</code> is <code>*b</code> here)</p>



<a name="130709273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709273">(Aug 01 2018 at 12:08)</a>:</h4>
<p>that ... might be a more elegant way to deal with this. Let me see.</p>



<a name="130709460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709460">(Aug 01 2018 at 12:11)</a>:</h4>
<p>you know, I almost seriously proposed adding <code>&amp;own T</code> to <code>rustc</code> internally to model locals which may be unsized :P</p>



<a name="130709554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709554">(Aug 01 2018 at 12:12)</a>:</h4>
<p>well a tree-like presentation can be a pain for understand the flow of a conversation over time. I guess internals.rust-lang.org's engine gets this right</p>



<a name="130709562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709562">(Aug 01 2018 at 12:12)</a>:</h4>
<p>(except that I hate that I have to scroll in order to get it to load content. But that's an orthogonal issue.)</p>



<a name="130709706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709706">(Aug 01 2018 at 12:15)</a>:</h4>
<blockquote>
<p>specifically the  part where <code>Drop(place)</code> should <em>always</em> invalidate the value at <code>place</code> <em>despite</em> being a noop for some types (<code>place</code> is <code>*b</code> here)</p>
</blockquote>
<p>My immediate thought is that this might cause problems for other similar cases where we have a <code>&amp;mut T</code> that isn't actually getting written. But maybe if the type is !needs_drop, then we should just use a Shallow write rather than a Deep one? I wonder if that would do the trick.</p>



<a name="130709879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709879">(Aug 01 2018 at 12:19)</a>:</h4>
<p>I wrote:</p>
<blockquote>
<p>Right now a <code>StorageDead</code> statement causes a Shallow Write. \[...\]</p>
</blockquote>
<p>and in fact that implies that the Shallow write to <code>b</code> (as opposed to <code>*b</code>) is <em>not necessary</em> in my PR. Because that is already done by the <code>StorageDead</code> statement.</p>



<a name="130709967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130709967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130709967">(Aug 01 2018 at 12:20)</a>:</h4>
<p>so, yay, I can <em>definitely</em> remove that.</p>



<a name="130710006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710006">(Aug 01 2018 at 12:21)</a>:</h4>
<p>you mean you can remove step 3? that'd be nice :D</p>



<a name="130710061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710061">(Aug 01 2018 at 12:22)</a>:</h4>
<p>I can definitely remove step 3</p>



<a name="130710073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710073">(Aug 01 2018 at 12:22)</a>:</h4>
<p>and I am seeing if I can replace step 2 with a revision of the handling of the general case</p>



<a name="130710078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710078">(Aug 01 2018 at 12:23)</a>:</h4>
<p>so that instead of only doing a write for needs_drop stuff</p>



<a name="130710085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710085">(Aug 01 2018 at 12:23)</a>:</h4>
<p>it will do <em>some</em> kind of write even if its non needs_drop. It might need to be a shallow write though</p>



<a name="130710134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710134">(Aug 01 2018 at 12:24)</a>:</h4>
<p>/me crosses fingers his obsession with semantic optimization of logic doesn't bite us back later</p>



<a name="130710160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710160">(Aug 01 2018 at 12:25)</a>:</h4>
<p>right, so if the general case does a deep write in all cases, then we "fail" to fix <a href="https://github.com/rust-lang/rust/issues/45696" target="_blank" title="https://github.com/rust-lang/rust/issues/45696">#45696</a></p>



<a name="130710163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710163">(Aug 01 2018 at 12:25)</a>:</h4>
<p>that's totally unsurprising</p>



<a name="130710249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710249">(Aug 01 2018 at 12:27)</a>:</h4>
<p>but the (good?) news is that doing a deep write doesn't break anything <em>except</em> <a href="https://github.com/rust-lang/rust/issues/45696" target="_blank" title="https://github.com/rust-lang/rust/issues/45696">#45696</a></p>



<a name="130710312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710312">(Aug 01 2018 at 12:28)</a>:</h4>
<p>which is entirely expected, right? I mean, it was doing that before</p>



<a name="130710325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710325">(Aug 01 2018 at 12:28)</a>:</h4>
<p>No this is more general</p>



<a name="130710331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710331">(Aug 01 2018 at 12:29)</a>:</h4>
<p>because this is changing code for the non-box cases too</p>



<a name="130710334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710334">(Aug 01 2018 at 12:29)</a>:</h4>
<p>(right?)</p>



<a name="130710345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710345">(Aug 01 2018 at 12:29)</a>:</h4>
<p>oh I thought you changed your PR, oops, you meant <code>StorageDead</code>?</p>



<a name="130710348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710348">(Aug 01 2018 at 12:29)</a>:</h4>
<p>as in, I'm playing games with the <code>_ =&gt; ...</code> arm at the end of the match</p>



<a name="130710359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710359">(Aug 01 2018 at 12:29)</a>:</h4>
<p>I haven't pushed any changes to my visible branch yet</p>



<a name="130710360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710360">(Aug 01 2018 at 12:29)</a>:</h4>
<p><code>Drop</code> then?</p>



<a name="130710366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710366">(Aug 01 2018 at 12:29)</a>:</h4>
<p>yeah I'm changing <code>visit_terminator_drop</code></p>



<a name="130710431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710431">(Aug 01 2018 at 12:30)</a>:</h4>
<p>We could talk about whether this belongs in <code>StorageDead</code> instead</p>



<a name="130710433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710433">(Aug 01 2018 at 12:30)</a>:</h4>
<p>but that sounds like a more invasive change</p>



<a name="130710445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710445">(Aug 01 2018 at 12:30)</a>:</h4>
<p>oh yeah we were talking about <code>Drop(x)</code> invalidating <code>x</code> even if <code>!needs_drop</code></p>



<a name="130710546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710546">(Aug 01 2018 at 12:33)</a>:</h4>
<p>I'm sort of surprised this change didn't break anything besides <a href="https://github.com/rust-lang/rust/issues/45696" target="_blank" title="https://github.com/rust-lang/rust/issues/45696">#45696</a> though. I'm going to play around with it a little more, try to double check that this doesn't represent some weakness in our test suite.</p>



<a name="130710612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710612">(Aug 01 2018 at 12:35)</a>:</h4>
<p>well, <code>Box&lt;T&gt;</code> is the only thing that owns without  getting <code>StorageDead</code> called on the owned (<code>T</code>) later</p>



<a name="130710665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710665">(Aug 01 2018 at 12:36)</a>:</h4>
<p>Yes, but a deep write on drop(x) seems bad when <code>x: &amp;mut T</code>, right?</p>



<a name="130710674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710674">(Aug 01 2018 at 12:36)</a>:</h4>
<p>do these deep things go through references?</p>



<a name="130710679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710679">(Aug 01 2018 at 12:36)</a>:</h4>
<p>that I think is one of the main distinctions</p>



<a name="130710680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710680">(Aug 01 2018 at 12:36)</a>:</h4>
<p>and <code>StorageDead</code> is not deep either?</p>



<a name="130710683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710683">(Aug 01 2018 at 12:36)</a>:</h4>
<p>StorageDead is just shallow</p>



<a name="130710692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710692">(Aug 01 2018 at 12:37)</a>:</h4>
<p>okay that is suspicious, I agree</p>



<a name="130710700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710700">(Aug 01 2018 at 12:37)</a>:</h4>
<blockquote>
<p>that I think is one of the main distinctions</p>
</blockquote>
<p>let me double-check this claim</p>



<a name="130710783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710783">(Aug 01 2018 at 12:39)</a>:</h4>
<p>so wait, why would a move be deep but a drop &amp; StorageDead be shallow?!</p>



<a name="130710793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710793">(Aug 01 2018 at 12:39)</a>:</h4>
<p>because a move can subsequently do something to the <code>&amp;mut</code> borrowed thing?</p>



<a name="130710797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710797">(Aug 01 2018 at 12:40)</a>:</h4>
<p>but a drop just dies?</p>



<a name="130710847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710847">(Aug 01 2018 at 12:40)</a>:</h4>
<p>not the move itself</p>



<a name="130710849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710849">(Aug 01 2018 at 12:40)</a>:</h4>
<p>but the thing you moved it into, that is</p>



<a name="130710861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710861">(Aug 01 2018 at 12:40)</a>:</h4>
<p>oh so it's the repossession of the value being moved?</p>



<a name="130710863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710863">(Aug 01 2018 at 12:40)</a>:</h4>
<p>am I making sense?</p>



<a name="130710866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710866">(Aug 01 2018 at 12:40)</a>:</h4>
<p>yeah that's how I look at it at least</p>



<a name="130710889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710889">(Aug 01 2018 at 12:40)</a>:</h4>
<p>I'm sure ariel and niko have a more disciplined mental model here</p>



<a name="130710912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710912">(Aug 01 2018 at 12:41)</a>:</h4>
<p>so it's a combination of stealing the value (which has the deep implications) and invalidating the place where the value was (like writing <code>undef</code> to it. which has the shallow implications)</p>



<a name="130710920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130710920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130710920">(Aug 01 2018 at 12:42)</a>:</h4>
<p>Yeah so <a href="https://github.com/rust-lang/rust/blob/8c069ceba81a0fffc1ce95aaf7e8339e11bf2796/src/librustc_mir/borrow_check/places_conflict.rs#L166" target="_blank" title="https://github.com/rust-lang/rust/blob/8c069ceba81a0fffc1ce95aaf7e8339e11bf2796/src/librustc_mir/borrow_check/places_conflict.rs#L166">places_conflict.rs</a> has the relevant code here</p>



<a name="130711943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130711943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130711943">(Aug 01 2018 at 13:00)</a>:</h4>
<blockquote>
<p>okay that is suspicious, I agree</p>
</blockquote>
<p>Ah, the reason that the tests pass is that we don't even <em>generate</em> the <code>Drop(x)</code> MIR instruction when <code>x: &amp;mut T</code>...</p>



<a name="130711948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130711948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130711948">(Aug 01 2018 at 13:00)</a>:</h4>
<p>we just have a <code>StorageDead</code></p>



<a name="130711965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130711965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130711965">(Aug 01 2018 at 13:01)</a>:</h4>
<p>so let me keep looking/poking...</p>



<a name="130712249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130712249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130712249">(Aug 01 2018 at 13:06)</a>:</h4>
<p>so I think the only cases that break when I add this Deep Write to the base case for <code>visit_terminator_drop</code> end up being related to <a href="https://github.com/rust-lang/rust/issues/45696" target="_blank" title="https://github.com/rust-lang/rust/issues/45696">#45696</a> in the end, because in order to observe the new Deep write that I've emitted here, you need to have some <code>Drop</code> statement emitted in the first place, which means you need to have some kind of droppable thing that owns the <code>&amp;mut T</code> in question</p>



<a name="130712382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130712382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130712382">(Aug 01 2018 at 13:08)</a>:</h4>
<p>what if... you remove the optimization from <code>librustc_mir/build/scope.rs</code>?</p>



<a name="130712404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130712404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130712404">(Aug 01 2018 at 13:09)</a>:</h4>
<p>does shallow vs deep make a huge difference then? I hope that nothing breaks because of all the extra drops</p>



<a name="130712433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130712433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130712433">(Aug 01 2018 at 13:09)</a>:</h4>
<p>you mean the early return if <code>!needs_drop</code> at the beginning of <code>fn schedule_drop</code> ?</p>



<a name="130712490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130712490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130712490">(Aug 01 2018 at 13:10)</a>:</h4>
<p>I imagine that if I were to do that, then the shallow vs deep distinction in this case would be hugely important.</p>



<a name="130712503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130712503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130712503">(Aug 01 2018 at 13:10)</a>:</h4>
<p>but hey, since I'm already experimenting, I can find out.</p>



<a name="130712810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130712810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130712810">(Aug 01 2018 at 13:15)</a>:</h4>
<blockquote>
<p>does shallow vs deep make a huge difference then? I hope that nothing breaks because of all the extra drops</p>
</blockquote>
<p>To be clear: I'm not planning on putting in a Deep write. If I did that, then <a href="https://github.com/rust-lang/rust/issues/45696" target="_blank" title="https://github.com/rust-lang/rust/issues/45696">#45696</a> would not get fixed, and this PR would be pointless.</p>



<a name="130712824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130712824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130712824">(Aug 01 2018 at 13:15)</a>:</h4>
<p>I was just trying it out as an experiment to try to understand the implications of such a change.</p>



<a name="130713015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130713015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130713015">(Aug 01 2018 at 13:19)</a>:</h4>
<p>yeah, I'm just curious what happens</p>



<a name="130713259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130713259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130713259">(Aug 01 2018 at 13:23)</a>:</h4>
<p>as am I. I first want to double check that this change actually <em>works</em> when the write is Shallow. If so, then I'll start playing with removing the optimization in schedule_drop</p>



<a name="130717967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130717967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130717967">(Aug 01 2018 at 14:31)</a>:</h4>
<p>okay, if you make the Deep Write happen both when needs_drop and !needs_drop, <em>and</em> you remove the optimization in schedule_drop, then a bunch of tests break. The simplest instance being </p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">return_local_reborrow</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="kt">i32</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="kt">i32</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="o">*</span><span class="n">x</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="130718035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718035">(Aug 01 2018 at 14:32)</a>:</h4>
<p>things are starting to make sense :D</p>



<a name="130718040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718040">(Aug 01 2018 at 14:32)</a>:</h4>
<p>now to find out what happens with my planned change to use Shallow Write if we get rid of the optimization in schedule_drop</p>



<a name="130718359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718359">(Aug 01 2018 at 14:38)</a>:</h4>
<p>interesting: even with just a Shallow Write, if you get rid of the optimization in <code>schedule_drop</code>, we get 13 test failures ... (compared to 19 failures with Deep Write when killing the <code>schedule_drop</code> optimization).</p>



<a name="130718400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718400">(Aug 01 2018 at 14:38)</a>:</h4>
<p>O</p>



<a name="130718401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718401">(Aug 01 2018 at 14:38)</a>:</h4>
<p>Oh wait</p>



<a name="130718405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718405">(Aug 01 2018 at 14:38)</a>:</h4>
<p>I need a control group</p>



<a name="130718414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718414">(Aug 01 2018 at 14:38)</a>:</h4>
<p>#science</p>



<a name="130718426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718426">(Aug 01 2018 at 14:38)</a>:</h4>
<p>As in, I need to try the <code>schedule_drop</code> change without adding an Write to this case at all. :)</p>



<a name="130718453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718453">(Aug 01 2018 at 14:38)</a>:</h4>
<p>right, there might be latent "bugs"</p>



<a name="130718460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718460">(Aug 01 2018 at 14:39)</a>:</h4>
<p>trying that now</p>



<a name="130718982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130718982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130718982">(Aug 01 2018 at 14:46)</a>:</h4>
<p>heh. 12 test failures from the <code>schedule_drop</code> change if I leave the Write change out of MIR-borrowck</p>



<a name="130719034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130719034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130719034">(Aug 01 2018 at 14:47)</a>:</h4>
<p>so there was <em>one</em> case where the Shallow Write on !needs_drop caused a failure if we don't include that optimization in <code>schedule_drop</code>. I'll work on identifying that and documenting it somewhere in the code.</p>



<a name="130719088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130719088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130719088">(Aug 01 2018 at 14:48)</a>:</h4>
<p>(This is based on the <code>compile-fail</code> tests; i arguably also need to test against the <code>ui</code> tests)</p>



<a name="130719674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130719674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130719674">(Aug 01 2018 at 14:58)</a>:</h4>
<p>or.. I just get 12 test failures this time. Shoot I wish I had saved that previous run's transcript</p>



<a name="130719690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130719690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130719690">(Aug 01 2018 at 14:58)</a>:</h4>
<p>I bet its one of the intermittent compile-fail tests that keeps biting me on this box</p>



<a name="130719837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130719837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130719837">(Aug 01 2018 at 15:00)</a>:</h4>
<p>the LLVM/link/something race one? I see the same thing, heh. what are the other 12?</p>



<a name="130719846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130719846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130719846">(Aug 01 2018 at 15:00)</a>:</h4>
<p>there might be a simple bug to fix, I'll look into it if you can share some logs</p>



<a name="130721338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130721338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130721338">(Aug 01 2018 at 15:22)</a>:</h4>
<p>a log like this: <a href="https://gist.github.com/1d49a599cdaac9030bb15518463b8fd8" target="_blank" title="https://gist.github.com/1d49a599cdaac9030bb15518463b8fd8">https://gist.github.com/1d49a599cdaac9030bb15518463b8fd8</a> ?</p>



<a name="130721345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130721345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130721345">(Aug 01 2018 at 15:23)</a>:</h4>
<p>or do you want RUST_LOG output?</p>



<a name="130721562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130721562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130721562">(Aug 01 2018 at 15:26)</a>:</h4>
<p>hmm, skimming over this myself, its "obvious" what the two-phase borrow breakage is... its treating the newly introduced drop as a use and complaining about it being a second use when we expect only one.</p>



<a name="130721773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130721773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130721773">(Aug 01 2018 at 15:30)</a>:</h4>
<p>and then the const-eval errors all seem like something where the new Drops are probably causing us to emit three (redundant) errors instead of "just" two?</p>



<a name="130722065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722065">(Aug 01 2018 at 15:35)</a>:</h4>
<p>so I don't think there 's evidence of any serious bug lying in wait.</p>



<a name="130722286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722286">(Aug 01 2018 at 15:39)</a>:</h4>
<p>only <code>compile-fail</code> fails? <code>run-pass</code> is fine?</p>



<a name="130722412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722412">(Aug 01 2018 at 15:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> I think I like these results, they seem to be confirming that trivial Drops are harmless/unnecessary</p>



<a name="130722648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722648">(Aug 01 2018 at 15:46)</a>:</h4>
<p>oh no I would need to check run-pass too</p>



<a name="130722707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722707">(Aug 01 2018 at 15:46)</a>:</h4>
<p>my setup here is sort of optimized for only focusing on one test suite at a time</p>



<a name="130722717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722717">(Aug 01 2018 at 15:46)</a>:</h4>
<p>try this :P <code>./x.py test --no-fail-fast --stage 1 src/test/{mir-opt,codegen,codegen-units,incremental,debuginfo,parse-fail,ui,compile-fail,run-fail,run-pass}</code></p>



<a name="130722722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722722">(Aug 01 2018 at 15:46)</a>:</h4>
<p>I'll look into that after I finish rebasing the PR</p>



<a name="130722742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722742">(Aug 01 2018 at 15:47)</a>:</h4>
<p>(and double checking that it works...)</p>



<a name="130722831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130722831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130722831">(Aug 01 2018 at 15:48)</a>:</h4>
<p>uh oh github is error 500'ing on my PR. :(</p>



<a name="130725243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130725243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130725243">(Aug 01 2018 at 16:29)</a>:</h4>
<p>GH had a hiccup there, seems back</p>



<a name="130774294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130774294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130774294">(Aug 02 2018 at 12:04)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> <span class="user-mention" data-user-id="120791">@RalfJ</span> do you two like the new version of PR <a href="https://github.com/rust-lang/rust/issues/52782" target="_blank" title="https://github.com/rust-lang/rust/issues/52782">#52782</a> ?</p>



<a name="130783453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130783453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130783453">(Aug 02 2018 at 15:06)</a>:</h4>
<p>I cannot really read NLL code and get anything out of that^^</p>



<a name="130783460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130783460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130783460">(Aug 02 2018 at 15:06)</a>:</h4>
<p>my previous comments were entirely based on <span class="user-mention" data-user-id="119009">@eddyb</span>'s comments</p>



<a name="130783471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box/near/130783471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pr-52782-dangly-paths-for-box.html#130783471">(Aug 02 2018 at 15:07)</a>:</h4>
<p>fair enough</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>